package com.zmn.plat.services.impl.product.guarantee;

import java.util.List;

import javax.annotation.Resource;

import com.zmn.plat.model.entity.category.ServCategAndCategTwoQuery;
import com.zmn.plat.model.vo.product.ShowProductIdVO;
import org.springframework.stereotype.Service;

import com.zmn.plat.model.entity.product.guarantee.ProductGuarantee;
import com.zmn.plat.model.entity.product.guarantee.ProductGuaranteeQuery;
import com.zmn.plat.persistence.interfaces.product.guarantee.ProductGuaranteeDao;
import com.zmn.plat.services.interfaces.product.guarantee.ProductGuaranteeService;

@Service
public class ProductGuaranteeServiceImpl implements ProductGuaranteeService {

    @Resource
    ProductGuaranteeDao productGuaranteeDao;

    @Override
    public ProductGuarantee findByKey(Integer productGuaranteeId) {
        return productGuaranteeDao.findByKey(productGuaranteeId);
    }

    @Override
    public ProductGuarantee findByProductId(Integer productId) {
        return productGuaranteeDao.findByProductId(productId);
    }

    @Override
    public List<ProductGuarantee> listByProductIds(List<Integer> productIdList) {
        return productGuaranteeDao.listByProductIds(productIdList);
    }

    @Override
    public List<ProductGuarantee> listPageByQuery(ProductGuaranteeQuery query) {
        int count = countByQuery(query);
        query.setTotalCount(count);
        return productGuaranteeDao.listPageByQuery(query);
    }

    @Override
    public List<ProductGuarantee> listByQuery(ProductGuaranteeQuery query) {
        return productGuaranteeDao.listByQuery(query);
    }

    @Override
    public List<ShowProductIdVO> listConfigGuaranteeProductIdByCategTwoQuery(List<ServCategAndCategTwoQuery> categIds) {
        return productGuaranteeDao.listConfigGuaranteeProductIdByCategTwoQuery(categIds);
    }

    @Override
    public List<ProductGuarantee> listAll() {
        return productGuaranteeDao.listAll();
    }

    @Override
    public Integer countByQuery(ProductGuaranteeQuery query) {
        return productGuaranteeDao.countByQuery(query);
    }

    @Override
    public Integer updateByKey(ProductGuarantee productGuarantee) {
        return productGuaranteeDao.updateByKey(productGuarantee);
    }

    @Override
    public Integer updateByProductIds(List<Integer> updateProductGuaranteeProductIds, ProductGuarantee updateGuarantee) {
        return productGuaranteeDao.updateByProductIds(updateProductGuaranteeProductIds,updateGuarantee);
    }

    @Override
    public Integer insert(ProductGuarantee productGuarantee) {
        return productGuaranteeDao.insert(productGuarantee);
    }

    @Override
    public Integer insertBatch(List<ProductGuarantee> addProductGuaranteeList) {
        return productGuaranteeDao.insertBatch(addProductGuaranteeList);
    }

    @Override
    public Integer deleteByKey(Integer productGuaranteeId) {
        return productGuaranteeDao.deleteByKey(productGuaranteeId);
    }

}